package com.slh.touchandroid.fragment;

import java.util.ArrayList;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;

import com.slh.touchandroid.R;
import com.slh.touchandroid.adapter.FunctionApdater;
import com.slh.touchandroid.model.FloatInfo;

public class ChangeIconFragment extends BaseFragment {
	private GridView iconGridView;
	private FunctionApdater iconApdater;
	private ArrayList<FloatInfo> infos = new ArrayList<FloatInfo>();

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_change_icon,
				container, false);
		iconGridView = (GridView) rootView
				.findViewWithTag(getString(R.string.tag_grid));
		loadIcon();
		return rootView;
	}

	private void loadIcon() {
		for (int i = 0; i < 14; i++) {
			FloatInfo info = new FloatInfo("", getResources().getIdentifier(
					"ic_android" + i, "drawable",
					getActivity().getPackageName()), "");
			infos.add(info);
		}
		iconApdater = new FunctionApdater(getActivity(),
				R.layout.row_common_vertical, infos);
		iconGridView.setAdapter(iconApdater);

	}
}
